<div id="tabs">
	<ul>
        <li id="current"><?php echo $this->Html->link(__('Thời gian', true), array('controller' => 'kehoaches', 'action' => 'lapkehoach',$donvi)); ?> </li>
        <li><?php echo $this->Html->link(__('Chọn thời gian', true), array('controller'=>'kehoaches','action' => 'addtt',$donvi)); 
                   ?></li>
	</ul>
</div>
<div class="kehoaches">
	<h2><?php __('Lập kế hoạch tác nghiệp của '.$tendv[0] ['donvis'] ['tendv']);?></h2>
    <h3 style="margin-top: 0px;">Xin vui lòng kiểm tra thời gian bạn muốn lập kế hoạch đã tồn tại hay chưa</h3>
	<table cellpadding="0" cellspacing="0" id="tables">
	<tr>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Thời gian';?></th>
			<th class="actions"><?php __('Lựa chọn');?></th>
	</tr>
	<?php
	$i = 0;$stt=0;
	foreach ($kehoaches as $kehoach):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $stt=$stt+1; ?>&nbsp;</td>
		<td>
			<?php echo $kehoach['Thoigian']['thoigian']; ?>
		</td>
       
        
		<td class="actions">
			<?php 
     // neu la trung tam
        If((date('d-m-Y',strtotime(
                    $kehoach['Thoigian']['ngaykt']))-date('d-m-Y',
                    strtotime($kehoach['Thoigian']['ngaybd'])))<8) {
            //neu la tuan thi hien ra
                                //echo $this->Html->link(__('Chỉ tiêu tuần', true), array('controller'=>'chitieunvs','action' => 'hienchitieu', $kehoach['Kehoach']['id']));
            if(in_array($kehoach['Kehoach']['id'],$dulieu))  
                   echo $this->Html->link(__('CV Kế Hoạch', true), array('controller'=>'nvngays','action' => 'sua', $kehoach['Kehoach']['id']));
            else
                  echo $this->Html->link(__('CV Kế Hoạch', true), array('controller'=>'nvngays','action' => 'kq', $kehoach['Kehoach']['id']));
                       
                       
            //echo $this->Html->link(__('Lũy kế tuần', true), array('controller'=>'ztkluykes','action' => 'index', $kehoach['Kehoach']['id']));
            echo $this->Html->link(__('Sửa', true), array('action' => 'edit', $kehoach['Kehoach']['id'],$donvi)); 
            echo $this->Html->link(__('Xóa', true), array('action' => 'delete', $kehoach['Kehoach']['id'],$donvi), null, sprintf(__('Bạn có chắc muốn xóa # %s?', true), $kehoach['Kehoach']['id']));
            
			       
        } 
        Else {
              echo $this->Html->link(__('CV chỉ thị', true), array('controller'=>'nvchithis','action' => 'index', $kehoach['Kehoach']['id']));
      
            //echo $this->Html->link(__('Lũy kế tháng', true), array('controller'=>'zluykes','action' => 'index', $kehoach['Kehoach']['id']));
            
                                //echo $this->Html->link(__('Chỉ tiêu tháng', true), array('controller'=>'chitieunvs','action' => 'hienchitieu', $kehoach['Kehoach']['id']));
                                //echo $this->Html->link(__('Edit', true), array('action' => 'edit', $kehoach['Kehoach']['id'])); 
                                //echo $this->Html->link(__('Delete', true), array('action' => 'delete', $kehoach['Kehoach']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $kehoach['Kehoach']['id']));  
        }
                   
        
          
                    ?>
                   
                    
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
